{template common/header}

<div id="side">
写信件
</div>
<div id="content">
<div class="pageheader">
	<div class="right">
		<ul class="tabs">
			<!--{if $do == 'unread'}--><li class="active"><!--{else}--><li><!--{/if}-->
				<a href="{URL}?fun=member&action=mail&do=unread">未读</a>
			</li>
			<!--{if $do == 'private' || !$do}--><li class="active"><!--{else}--><li><!--{/if}-->
				<a href="{URL}?fun=member&action=mail&do=private">私人信件</a>
			</li>
			<!--{if $do == 'common'}--><li class="active"><!--{else}--><li><!--{/if}-->
				<a href="{URL}?fun=member&action=mail&do=common">提醒</a>
			</li>
			<!--{if $do == 'new'}--><li class="active"><!--{else}--><li><!--{/if}-->
				<a href="{URL}?fun=member&action=mail&do=new">写新信</a>
			</li>
		</ul>
	</div>
</div>
<div class="clear"></div>
<!--{if $do == 'private' || !$do}-->
	<table class="olt" style="clear:both">
		<tbody>
			<tr>
				<td class="pl" style="width:112px;"><span class="mail_from">对话人</span></td>
				<td width="20"></td>
				<td class="pl">话题</td>
				<td class="pl">详情</td>
				<td class="pl" style="width:110px;">时间</td>
			</tr>
			{loop $ls $key $value}
			<tr id="{$value[pmid]}">
				<td class="pl"><div class="mail_from"><a href="{URL}/{$value[msgfromid]}">{$value[msgfrom]}</a></div></td>
				<td></td>
				<td {if $value['new'] == 1}class="bold"{/if}><a href="{URL}/?fun=member&action=mail&do=node&touid=$value[msgfromid]">{$value[subject]}</a></td>
				<td>{$value[message]}</td>
				<td class="pl">{eval echo dgmdate($value[dateline], 'u')}</td>
			</tr>
			{/loop}
		</tbody>
	</table>
	{$page}
<!--{elseif $do == 'common'}-->
<!--{elseif $do == 'unread'}-->
	<table class="olt" style="clear:both">
		<tbody>
			<tr>
				<td class="pl" style="width:112px;"><span class="mail_from">对话人</span></td>
				<td width="20"></td>
				<td class="pl">话题</td>
				<td class="pl">详情</td>
				<td class="pl" style="width:110px;">时间</td>
			</tr>
			{loop $ls $key $value}
			<tr id="{$value[pmid]}">
				<td class="pl"><div class="mail_from"><a href="{URL}/{$value[msgfromid]}">{$value[msgfrom]}</a></div></td>
				<td></td>
				<td {if $value['new'] == 1}class="bold"{/if}><a href="{URL}/?fun=member&action=mail&do=node&touid=$value[msgfromid]">{$value[subject]}</a></td>
				<td>{$value[message]}</td>
				<td class="pl">{eval echo dgmdate($value[dateline], 'u')}</td>
			</tr>
			{/loop}
		</tbody>
	</table>
	{$page}
<!--{elseif $do == 'new'}-->
	<h2>发送新信息</h2>
	<form method="post" action="">
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<p><label>收信人:</label><input type="text" name="pmname"  class="half"/></p>
		<p><label>标题:</label><input type="text" name="pmsubject"  class="half"/></p>
		<p><label></label><textarea type="text" name="pmtext" class="full textarea"></textarea></p>
		<p><input type="submit" value="发送" name="msubmit" class="subbox" /></p>
	</form>
<!--{elseif $do == 'node'}-->
	<div class="mailarea">
	<!--{loop $ls $key $value}-->
		<div class="maillist">
			<div {if $value['msgfromid'] == $_G['uid']}class = "right"{else}class = "left"{/if}>
				{eval echo avatarshow($value[msgfromid], 'small', 1, $value[msgfrom])}
			</div>
			<div {if $value['msgfromid'] == $_G['uid']}class = "mail left"{else}class = "mail right"{/if}>
				<div class = "mailto left">
					<span {if $value['msgfromid'] == $_G['uid']}class = "right"{else}class = "left"{/if}>
					{$value[msgfrom]}
					</span>
					<span {if $value['msgfromid'] == $_G['uid']}class = "mailtime left"{else}class = "mailtime right"{/if}>
					{eval echo dgmdate($value[dateline], 'u')}
					</span>
				</div>
				<div class="clear"></div>
				<div class = "mailtext">
					{eval echo nl2br(html_entity_decode($value[message]))}
				</div>
			</div>
			<div class="clear"></div>
		</div>
	<!--{/loop}-->
	</div>
	<div class="clear"></div>
	<div class="replymail">
		<div class="left">{eval echo avatarshow(NULL, 'small', 1)}</div>
		<div class="mail right">
			<form action="" method="post">
				<input type="hidden" name="formhash" value="{FORMHASH}" />
				<input type="hidden" name="touid" value="{$touid}" />
				<textarea name="replymail" class="textarea full"></textarea>
				<input name="rsubmit" type="submit" value="回复" />
			</form>
		</div>
	</div>
<!--{/if}-->
</div>
{template common/footer}